Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

118
Vistas
Do-While Loop Not Working | TimeOut might be the problem HTML and JS

I am trying to create a growing/shrinking effect with WebGL.
I approached this problem by using setTimeout().
I incorporated a do-while loop so that this process can repeat

However, the growing/shrinking only occurs once.

My Code:

document.getElementById("groNShrink").onclick = function()
  {
  var millisecondsToWait = 500;
  var max                = 3; // Max times
  do
    {
    balloonEffect++;
    for (var i = 0; i < max; i++)
      {
      setTimeout(function () 
        {
        changeRadius /= 1.15;
        }
        , millisecondsToWait * i);
      }
    setTimeout(function ()
      {
      for (var x = max; x !== 0; x--) 
        {
        setTimeout(function () 
          {
          changeRadius *= 1.15;
          }
          , millisecondsToWait * x);
        }
      }
      , millisecondsToWait * max);
    } 
  while (balloonEffect % 2 == 0);
  };

This is just my for my do-while loop.
I don't see where I went wrong maybe another pair of eyes will help.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda